package com.gs.cd.cloud.start.config;

import com.gs.cd.cloud.start.exception.DefaultGlobalExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.web.context.WebApplicationContext;

public class CloudStartAutoConfiguration {
    @Autowired
    WebApplicationContext applicationContext;

    /**
     * 注入全局异常处理器
     *
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(DefaultGlobalExceptionHandler.class)
    public DefaultGlobalExceptionHandler defaultGlobalExceptionHandler() {
        return new DefaultGlobalExceptionHandler();
    }

    @Bean
    @ConditionalOnMissingBean(DefaultCheckController.CheckServiceStatusDefault.class)
    public DefaultCheckController.CheckServiceStatusDefault defaultApplication() {
        return new DefaultCheckController.CheckServiceStatusDefault();
    }

}
